<?php
require_once '../include.php';

use sdk\WeiXin;
use sdk\Db;

################################################################################
$shop_id = 1;
$poi_id = 284628051;
################################################################################


$WeiXin = new WeiXin($serverAppName, $serverAppId, $serverAppSecret);
$Db = new Db($host, $username, $passwd, $schema);

$json_str = '{ "poi_id":"' . $poi_id . '" }';

$res = json_decode($WeiXin->getShop($json_str), true);

$shop = $res['business']['base_info'];

try {
    $Db->createShop($shop_id, $shop);
} catch (Exception $e) {
    var_dump($e->getMessage());
}
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        echo $shop['poi_id'];
        echo $shop['business_name'];
        ?>
    </body>
</html> 